package com.yykj.user.center.server.repository;

import com.yykj.user.center.server.model.RelationGroupPatient;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface RelationGroupPatientRepository extends JpaRepository<RelationGroupPatient, String>, JpaSpecificationExecutor<RelationGroupPatient> {

    List<RelationGroupPatient> findAllByDoctorIdAndPatientCardIdInAndType(String doctorId,List<String> patientCardIds,Integer type);

    RelationGroupPatient findFirstByGroupIdAndPatientCardId(String groupId,String patientCardId);

    List<RelationGroupPatient> findAllByGroupId(String groupId);

    List<RelationGroupPatient> findAllByPatientCardIdAndType(String patientCardId,Integer type);

    List<RelationGroupPatient> findAllByGroupIdAndPatientCardIdIn(String groupId,List<String> cardIds);

    List<RelationGroupPatient> findAllByPatientCardIdAndDoctorId(String patientCardId,String doctorId);

    void deleteByGroupIdAndPatientCardId(String groupId, String patientCardId);
}
